home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1812 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.1 KB  |  33 lines

  1. Path: rap.SanDiegoCA.ATTGIS.COM!es013!jbc
  2. From: jbc@ElSegundoCA.ATTGIS.COM (Jim Chapman)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: class defined after use?
  5. Date: 13 Jan 1996 01:37:19 GMT
  6. Organization: AT&T Global Information Solutions
  7. Distribution: world
  8. Message-ID: <4d72cf$gig@rap.SanDiegoCA.ATTGIS.COM>
  9. References: <4d4l4a$ecg@news1.wolfe.net>
  10. Reply-To: jbc@ElSegundoCA.ATTGIS.COM
  11. NNTP-Posting-Host: es013.elsegundoca.attgis.com
  12.  
  13. In article ecg@news1.wolfe.net, mgooding@wolfe.net (Joshua Gooding) writes:
  14. > Is it possible to have a class with a pointer to a variable of another 
  15. > type that is defined later int he file?
  16.  
  17.  
  18. Absolutely.  Use a forward class declaration, e.g.
  19.  
  20.    class Foo;  // forward declaration of Foo
  21.  
  22.    class Bar {
  23.      Foo* x;
  24.    };
  25.  
  26.    class Bar { ... }; // real definition of Foo
  27. ---
  28.  ====  AT&T        | Jim Chapman             |
  29. =--=== Global      | Multimedia Projects     | jbc@ElSegundoCA.ATTGIS.COM
  30. =--=== Information | 100 N. Sepulveda Blvd.  |   Voice: (310) 524-6747          
  31.  ====  Solutions   | El Segundo, CA 90245    |   FAX:   (310) 524-5515
  32.  
  33.